Infinite loops and deadlocks are reasons that programs and operating systems (OSs) “get stuck” or “hang”. It is an especially pervasive and difficult problem when an OS or application is using third party components. In this manner, when third party code is run and acts as part of a program or operating system, then infinite loops in the third party code can “hang” the program or operating system. Typically, when running the third party components, the host has little control or input over the source code of the component and therefore this third party component may be considered “untrusted”. In this regard, these components perform intermittently, behaving normally in most circumstances and only occasionally causing a problem to the host.
Exceptions are errors or abnormal situations that occur during the processing of instructions. Typically, such exceptions cause a deviation from the sequence of execution. Once an exception is raised, typically, an exception handler processes the exception. An exception handler is a set of instructions or routines that is invoked when an exception of the appropriate type occurs.
Today it is possible for an exception to be raised in a process thread; however, exceptions can only be raised within the thread as a side effect of something that particular thread does. For example, a thread can try to access memory to which it does not have access and raise a memory management exception, or it can try to divide by zero and raise a division by zero exception. Currently, however, there is a need for systems and methods for raising an exception or injecting an exception in another thread.